package gatperdut.chato.core.characters.health;

import gatperdut.chato.core.characters.BaseController;
import gatperdut.chato.model.Chato.Entity.Health;

public class HealthController {

    public enum LifeStatus {
        ALIVE, DEAD;
    };

    private BaseController baseController;

    private final Health health;

    public HealthController( Health health ) {
        this.health = health;
    }

    public LifeStatus beHurt( int dam ) {
        getHealth().setHp( getHealth().getHp() - dam );
        return characterIsAlive();
    }

    public LifeStatus characterIsAlive() {
        if ( getHealth().getHp() > 0 ) {
            return LifeStatus.ALIVE;
        }
        else {
            return LifeStatus.DEAD;
        }
    }

    public int getHP() {
        return getHealth().getHp();
    }

    public void setHP( int hp ) {
        getHealth().setHp( hp );
    }

    public BaseController getBaseController() {
        return baseController;
    }

    public void setBaseController( BaseController baseController ) {
        this.baseController = baseController;
    }

    public Health getHealth() {
        return health;
    }

}
